import React, { useRef } from 'react';
function RefFC2() {
    const inputRef = useRef(null);
    const handleClick = () => {
        const value = inputRef.current.value;
        console.log(value)
    };
    return (
        <div>
            <input
                type="text"
                placeholder="请输入内容"
                ref={inputRef}
            />
            <button
                onClick={() => {
                    handleClick()
                }}
            >
                点击显示
            </button>
        </div>
    );
}
export default RefFC2;